<include file="../header" />
<div id="left-sider"><include file="../left-sider" /></div>
<style type="text/css">
.main-bd > div {
	margin-bottom: 30px;
	padding: 10px;
	border-bottom: 1px dotted #999;	
}
textarea {
	width: 100%;
	height: 90px;	
}
.filename {
	width: 200px;
}
.filepath {
	width: 400px;
}
#sponsor_logo {
	width: 65%;
	height: 150px;
}
</style>
<div id="main">
  <div class="main-hd">
    <h2>首页和底部信息设置</h2>
  </div>
  <div class="main-bd">
  	<div>
        	<h3>Welcome to the home of Dian Racing!</h3>
			<p class="help">请在下方的文本框中编辑首页上的欢迎辞</p>
            <table width="100%" border="0">
                <tr>
					<form method="post" target="_self" action="welcome">
						<th scope="col">简体中文</th>
						<td><textarea name="value">{$welcome_cn['value']}</textarea></td>
						<td><input type="submit" value="更新"/><input type="hidden" name="id" value="{$welcome_cn['id']}" /></td>
					</form>
                </tr>
                <tr>
					<form method="post" target="_self" action="welcome">
						<th scope="col">English</th>
						<td><textarea name="value">{$welcome_en['value']}</textarea></td>
						<td><input type="submit" value="更新"/><input type="hidden" name="id" value="{$welcome_en['id']}" /></td>
					</form>
                </tr>
            </table>
    </div>
    <div>
    	<form method="post" target="_self" action="downloads">
            <h3>下载项</h3>
			<p class="help">下载项将被显示在页面下方的“下载”中。<br/>点击上传按钮，在新窗口中选择并上传文件，上传成功后会自动关闭窗口和填写文件地址，点击更新即可保存。<br/>如要删除，则直接删空一行上的两个文本框。</p>
			<table>
				<tr>
					<th>显示名称</th>
					<th>文档地址</th>
					<th>-</th>
				</tr>
				<volist name="downloads" id="dl">
				<tr>
					<td><input class="filename" type="text" name="filename[]" value="{$dl['name']}"/></td>
					<td><input id="path-{$i}" class="filepath" type="text" name="filepath[]" value="{$dl['path']}"/></td>
					<td><input class="uploadBtn" type="button" value="上传" lang="path-{$i}"/></td>
				</tr>
				</volist>
				<!--for start="0" end="3">
				<tr>
					<td><input class="filename" type="text" name="filename[]"/></td>
					<td><input id="path-{$i}" class="filepath" type="text" name="filepath[]"/></td>
					<td><input class="uploadBtn" type="button" value="上传" lang="path-{$i}"/></td>
				</tr>
				</for-->
			</table>
			<input type="submit" value="更新"/>
        </form>
    </div>
    <div>
		<form method="post" target="_self" action="sponsor">
			<h3>赞助商LOGO</h3>
			<p class="help">LOGO将被显示在页面下方，一行一个图片地址，过多将影响显示效果。<br/>图片可上传至Sponsor相册，然后在相册中获取图片原始地址。</p>
			<p><textarea id="sponsor_logo" name="sponsor_logo">{$sponsor}</textarea>
			<input type="submit" value="Update" /></p>
		</form>
    </div>
  </div>
</div>
<include file="../footer" />

<import type="js" file="js.jquery"/>
<import type="js" file="js.xheditor"/>
<script type="text/javascript">
$('textarea[name=value]').xheditor({tools:'Bold,Italic,|,List,Fontface,FontSize,FontColor,Img,|,Removeformat,Source', upImgUrl:"/admin.php/Upload/ajax_pic",upImgExt:"jpg,jpeg,gif,png",html5Upload:false, width: '100%'});

$('.uploadBtn').click(function(){
	window.open("{:U('Upload/brochure')}?prefix=/Uploads/docs/&cbi="+this.lang);
});
</script>